// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   check_delete_ok.java

package manufacture.procedure;

import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class check_delete_ok extends HttpServlet
{

	public check_delete_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		nseer_db_backup1 manufacture_db = new nseer_db_backup1(dbApplication);
		try
		{
			if (manufacture_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				String manufacture_ID = request.getParameter("manufacture_ID");
				String designer = request.getParameter("designer");
				String register = request.getParameter("register");
				String register_time = request.getParameter("register_time");
				String checker = request.getParameter("checker");
				String check_time = request.getParameter("check_time");
				String bodyb = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
				String remark = exchange.toHtml(bodyb);
				String sql1 = (new StringBuilder("select * from manufacture_manufacture where manufacture_ID='")).append(manufacture_ID).append("'").toString();
				for (ResultSet rs1 = manufacture_db.executeQuery(sql1); rs1.next();)
				{
					String sql4;
					for (StringTokenizer tokenTO = new StringTokenizer(rs1.getString("apply_id_group"), ", "); tokenTO.hasMoreTokens(); manufacture_db.executeUpdate(sql4))
						sql4 = (new StringBuilder("update manufacture_apply set manufacture_tag='0' where id='")).append(tokenTO.nextToken()).append("'").toString();

				}

				String sql = (new StringBuilder("update manufacture_manufacture set designer='")).append(designer).append("',register='").append(register).append("',register_time='").append(register_time).append("',remark='").append(remark).append("',checker='").append(checker).append("',check_time='").append(check_time).append("',check_tag='9' where manufacture_ID='").append(manufacture_ID).append("'").toString();
				manufacture_db.executeUpdate(sql);
				manufacture_db.commit();
				manufacture_db.close();
				response.sendRedirect("manufacture/procedure/check_list.jsp");
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
